Skip to main content

Create User

Create User Example

For creating a new user you need to use the createUser and provide a data object userType

Check the example:

import { createUser } from 'react-native-altibbi';

const data: UserType = {
name: 'Altibbi User',
email: '[email protected]',
date_of_birth: '2000-01-30',
gender: 'male', // Accepted Values: 'male' | 'female'
insurance_id: '123123123',
policy_number: '111111111',
height: 180,
weight: 90,
blood_type: 'A+', // Accepted Values: 'A+' | 'B+' | 'AB+' | 'O+' | 'A-' | 'B-' | 'AB-' | 'O-'
smoker: 'yes', // Accepted Values: 'yes' | 'no'
alcoholic: 'no', // Accepted Values: 'yes' | 'no'
marital_status: 'single', // Accepted Values: 'single' | 'married' | 'divorced' | 'widow'
relationType: 'brother' // Accepted Values: 'personal' | 'father' | 'mother' | 'sister' | 'brother' | 'child' | 'husband' | 'wife' | 'other',
};
const response = await createUser(data)

Consider that not all UserType data are required

Responses

Status 201

Success

{
"id": '999999999',
"name": "Altibbi User",
"email": "[email protected]",
"date_of_birth": "2000-01-30",
"gender": "male",
"insurance_id": "123123123",
"policy_number": "111111111",
"height": 180,
"weight": 90,
"blood_type": "A+",
"smoker": "yes",
"alcoholic": "no",
"marital_status": "single"
}

Status 401

UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.

{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\\\web\\\\UnauthorizedHttpException"
}

Status 422

Data Validation Failed.

[
{
"field": "string",
"message": "string"
}
]